﻿using MachineVision.Core;
using MachineVision.Models;
using MachineVision.Services;
using Prism.Commands;
using Prism.Regions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MachineVision.ViewsModels
{
    internal class DashboardViewModel : NavigationViewModel
    {
        private readonly IRegionManager manager;

        public INavigationMenuService NavigationMenuService { get; }
        public DashboardViewModel(INavigationMenuService navigationMenuService, IRegionManager manager) 
        {
            this.NavigationMenuService = navigationMenuService;
            this.manager = manager;
            this.OpenPageCommand = new DelegateCommand<NavigationItem>(OpenPage);
        }

        public DelegateCommand<NavigationItem> OpenPageCommand { get; private set; }
        private void OpenPage(NavigationItem item)
        {
            manager.Regions["MainViewRegion"].RequestNavigate(item.PageName);
        }

        public override void OnNavigatedTo(NavigationContext navigationContext)
        {
            base.OnNavigatedTo(navigationContext);
        }
    }
}
